//
//  YZMAddBankCardCell.m
//  YZMicroStock
//
//  Created by Lv.Dongdong on 16/7/13.
//  Copyright © 2016年 cqjr. All rights reserved.
//

#import "YZMAddBankCardCell.h"

@implementation YZMAddBankCardCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self createObjects];
    }
    
    return self;
}

- (void)createObjects {
    
    WS(ws)
    self.placeholderLB = [YZMAppStyle labelWithMediumGray];
    self.placeholderLB.hidden = YES;
    self.placeholderLB.textAlignment = NSTextAlignmentLeft;
    [self addSubview:self.placeholderLB];
    [self.placeholderLB mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerY.equalTo(ws);
        make.left.equalTo(ws).offset(90);
        make.right.equalTo(ws).offset(-30);
    }];
    
    self.bankNumTF = [[UITextField alloc] init];
    self.bankNumTF.hidden = YES;
    self.bankNumTF.placeholder = @" ";
    [self.bankNumTF setValue:[YZMAppStyle colorForGrayText] forKeyPath:@"_placeholderLabel.textColor"];
    [self.bankNumTF setValue:[YZMAppStyle mediumSizeFont] forKeyPath:@"_placeholderLabel.font"];
    self.bankNumTF.keyboardType = UIKeyboardTypeNumberPad;
    self.bankNumTF.textColor = [YZMAppStyle colorForMainTextColor];
    [self.bankNumTF addTarget:self action:@selector(textValueChanged:) forControlEvents:UIControlEventEditingChanged];
    [self addSubview:self.bankNumTF];
    [self.bankNumTF mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerY.equalTo(ws.textLabel);
        make.left.right.equalTo(ws.placeholderLB);
    }];
}

- (void)showContentcontroller:(BOOL)isShow {
    
    if (isShow) {
        
        self.placeholderLB.hidden = NO;
        self.bankNumTF.hidden = YES;
    } else {
        
        self.placeholderLB.hidden = YES;
        self.bankNumTF.hidden = NO;
        [self.bankNumTF setValue:[YZMAppStyle mediumSizeFont] forKeyPath:@"_placeholderLabel.font"];
    }
}

- (void)textValueChanged:(UITextField *)send {
    
    self.selectAction(send);
}

@end
